Skip to content

Remove duplicate #include statements#21085

Merged
TimWolla merged 2 commits intophp:masterfrom
khaledalam:cleanup/remove-duplicate-includes
Jan 30, 2026
Merged

Remove duplicate #include statements#21085
TimWolla merged 2 commits intophp:masterfrom
khaledalam:cleanup/remove-duplicate-includes

Conversation

@khaledalam
Copy link
Copy Markdown
Contributor

@khaledalam khaledalam commented Jan 29, 2026

Description

Remove 26 duplicate #include statements from 21 files across the codebase.

Motivation

  • Improves code clarity by removing visual noise
  • Makes dependency graphs cleaner for static analysis tools
  • Aligns with coding standards for maintainable code

Compile-Time Impact

Removes 26 redundant file lookups and preprocessor guard evaluations during compilation.

Changes

Directory Files Modified
Zend/ 3
main/ 2
sapi/ 10
ext/ 6

Notable duplicates removed:

  • php.h, php_globals.h in SAPI files
  • zend_vm_opcodes.h in zend_compile.h
  • http_core.h in apache2handler (3 files)
  • <sys/types.h> in multiple wrappers

Notes

  • All removed includes were true duplicates (unconditional, same file)
  • Excludes intentional duplicates in #if/#elif branches
  • No functional changes - include guards already prevented reprocessing

Copy link
Copy Markdown
Member

@DanielEScherzer DanielEScherzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked all files, mostly looks good but one file has issues

Comment thread sapi/litespeed/lscriu.c
Comment thread sapi/litespeed/lscriu.c
@khaledalam
Copy link
Copy Markdown
Contributor Author

Thanks @DanielEScherzer for the feedback, yes I were try to be careful about exclude conditional ones but i missed that file.

Copy link
Copy Markdown
Member

@DanielEScherzer DanielEScherzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now

@TimWolla TimWolla merged commit d03d69a into php:master Jan 30, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants